﻿using Bogus;
using IceZero.DataStore.Models;
using IceZero.DataStore.Models.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IceZero.DataStore.InitDB
{
    public partial class DbInitializer
    {
        private void InitCat()
        {
            var dataStore = new DataStoreBase<Cat>();
            if (dataStore.Count() > 0)
            {
                return;
            }
            Randomizer.Seed = new Random(66457);
            for (int i = 0; i < 15; i++)
            {
                var cat = new Faker<Cat>()
                    .RuleFor(o => o.Name, f => f.Name.FirstName())
                    .RuleFor(o => o.Weight, f => f.Random.Float(2.1F, 5.5F))
                    .RuleFor(o => o.Id, f => "Cat" + i)
                    .RuleFor(o => o.Sex, f => f.Random.Int(1000) % 2 == 0 ? "male" : "female")
                    .RuleFor(o => o.Code, f => f.Random.Int(1000))
                    .Generate();
                dataStore.Save(cat);
            }
        }
    }
}
